#include "myMainWindow.h"

myMainWindow::myMainWindow()
{
	mMainWindow.setupUi(this);
	QDesktopWidget *desktop = QApplication::desktop();
	move((desktop->width() - this->width())/2, (desktop->height() - this->height())/2);
	setWindowFlags(windowFlags() & ~Qt::WindowMaximizeButtonHint);
	setFixedSize(this->width(), this->height());
	setWindowTitle(cntr("信风"));
	mContactData = new contactData();
	mInboxListData = new inboxListData(QString("inbox.xml"));
	mTrushListData = new inboxListData(QString("trush.xml"));

	setContact();
	setInbox();
	connect(mContactListWidget, SIGNAL(contactDataChanged()),
			mInboxListWidget, SLOT(updateList()));
	connect(mInboxListData, SIGNAL(dataChanged()), mInboxListWidget, SLOT(updateList()));
	connect(mTrushListData, SIGNAL(dataChanged()), mTrushListWidget, SLOT(updateList()));
}

void myMainWindow::setLanChinese()
{
	printf("setLanChinese\n");
}

void myMainWindow::setContact()
{
	mContactListWidget = new contactListWidget(this, mContactData);
	mMainWindow.contacterVLayout->addWidget(mContactListWidget);

}

void myMainWindow::setInbox()
{
	mInboxListWidget = new inboxListWidget(this,mContactData, mInboxListData, mTrushListData);
	mMainWindow.inboxVBoxLayout->addWidget(mInboxListWidget);	

	mTrushListWidget = new inboxListWidget(this,mContactData, mTrushListData, mInboxListData);
	mMainWindow.trushVBoxLayout->addWidget(mTrushListWidget);	
}
